<script setup>
    import { ref, reactive, getCurrentInstance} from 'vue';
    const axios = getCurrentInstance().proxy.$http;
    const props = defineProps(['id'])
    
    console.log(props.id); 
    const infoData = ref({});
    const getInfromation = async () => {
        let res = await axios.get(`/playlist/detail/?id=${props.id}`)
        infoData.value = res.data.playlist;
    }
    getInfromation();
    
    
</script>

<template>
    <section class="top">
        <div class="left">
            <img :src="infoData.coverImgUrl" alt="">
        </div>
        <div class="right">
            <div class="title">
                <div class="icon"></div>
                <span> {{infoData.name}} </span>
            </div>
            <!-- 功能区 -->
            <Fun :id="props.id"></Fun>
            <!-- 标题 -->
            <label>
                <span v-show="infoData.tags?.length">标题：</span>
                <div v-for="(item, index) of infoData.tags" :key="index">{{item}}</div>
            </label>
            <p v-show="infoData.description">介绍：{{infoData.description}}</p>
        </div>
    </section>
</template>

<style lang='less' scoped>
    .top{
        width: 100%;
        margin-bottom: 50px;
        display: flex;
        .left{
            width: 208px;
            height: 208px;
            border: 1px solid #ccc;
            display: flex;
            align-items: center;
            justify-content: center;
            img{
                width: 200px;
                height: 200px;
            }
        }
        
        .right{
            padding-left: 20px;
            flex-grow: 1;
            height: 100px;
            .title{
                .icon{
                    width: 54px;
                    height: 24px;
                    float: left;
                    background: url(/img/icon.29cd8439.png) no-repeat;
                    background-position: 0 -463px;
                    margin-right: 10px;
                }
                span{
                    font-size: 18px;
                    font-weight: 500;
                }
            }
            label{
                font-size: 12px;
                display: block;
                display: flex;
                align-items: center;
                margin-bottom: 10px;
                span{
                    float: left;
                }
                div{
                    float: left;
                    padding: 3px 10px;
                    background: linear-gradient(to bottom, rgb(226, 226, 226), white, rgb(226, 226, 226));
                    border: 1px solid #ccc;
                    border-radius: 10px;
                    margin-right: 10px;
                }
            }
            p{
                white-space: pre-line;
                font-size: 12px;
                line-height: 20px;
                color: rgb(70, 70, 70);
                // border: 1px solid black;
                height: 140px;
                overflow: hidden;
            }
        }
    }
</style>